{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

{% extends base_template %}

{% block title %}
    {% if admin.id(object) %}
        {{ "title_edit"|trans({'%name%': admin.toString(object) }, 'SonataAdminBundle') }}
    {% else %}
        {{ "title_create"|trans({}, 'SonataAdminBundle') }}
    {% endif %}
{% endblock%}

{% block actions %}
    <div class="sonata-actions">
        <ul>
            {% if admin.hasroute('show') and admin.id(object) and admin.isGranted('VIEW', object) and admin.show|length > 0 %}
                <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('show', object) }}">{% trans from 'SonataAdminBundle' %}link_action_show{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasroute('history') and admin.id(object) and admin.isGranted('EDIT', object) %}
                <li class="btn sonata-action-element"><a href="{{ admin.generateObjectUrl('history', object) }}">{% trans from 'SonataAdminBundle' %}link_action_history{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasroute('create') and admin.isGranted('CREATE') and admin.id(object)%}
                <li class="btn sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from 'SonataAdminBundle' %}link_action_create{% endtrans %}</a></li>
            {% endif %}
            {% if admin.hasroute('list') and admin.isGranted('LIST')%}
                <li class="btn sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from 'SonataAdminBundle' %}link_action_list{% endtrans %}</a></li>
            {% endif %}
        </ul>
    </div>
{% endblock %}

{% block side_menu %}{{ knp_menu_render(admin.sidemenu(action), {}, 'list') }}{% endblock %}

{% use 'ProdutosBundle:Produto:edit_form.html.twig' with form as parentForm %}

{% block form %}
    {{ block('parentForm') }}
{% endblock %}
